<template>
	<view class="wrap">
		<view class="off" v-for="item in resData.list" @click="coupon_info" :data-id="item.id">
			<view class="off-img">
				<image :src="item.thumb" class="off-image"></image>
			</view>
			<view class="off-info">
				<view class="off-name">{{item.name}}<text class="red">{{item.money}}元</text></view>
				<view class="off-time">活动时间：{{item.time}} 至 {{item.ling_time}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				resData: []
			}
		},

		/**
		 * 生命周期函数--点击事件集合
		 */
		methods: {
			coupon_info(e){
				var id = e.currentTarget.dataset.id
				uni.navigateTo({
					url: '/pages/works/coupon?id='+id
				})
			},
			get_list(){
				this.$http({
					url: 'Api/Work/coupon_list',
					data: '',
					hideLoading: false,
					success: res => {
						this.resData = res.data
					}
				})
			}
		},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad(options) {
			this.get_list()
		},

		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady() {

		},

		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh() {

		},

		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom() {

		},
	}
</script>

<style>
	.wrap {
		padding: 30rpx;
	}

	.off {
		box-shadow: 0 10rpx 10rpx rgba(0, 0, 0, .1);
		margin-bottom: 20rpx;
	}

	.off-image {
		height: 240rpx;
	}

	.off-info {
		padding: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		height: 180rpx;
		border: 1px #e6e6e6 solid;
		border-top: none;
	}

	.off-name {
		font-weight: bold;
		font-size: 30rpx;
		color: #333;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.off-time {
		font-size: 24rpx;
		color: #4c4c4c;
	}
</style>
